using System.ComponentModel.DataAnnotations.Schema;

namespace Lzfy_His_Service.Models
{
    public class RefundMaster
    {
        public int Id { get; set; }
        
        [Column("input_date")]
        public DateTime? InputDate { get; set; }
        
        [Column("patient_id")]
        public string? PatientId { get; set; }
        
        [Column("pat_name")]
        public string? PatName { get; set; }
        
        [Column("id_number")]
        public string? IdNumber { get; set; }
        
        [Column("phone_number")]
        public string? PhoneNumber { get; set; }
        
        [Column("refund_bank_name")]
        public string? RefundBankName { get; set; }
        
        [Column("refund_bank_card_no")]
        public string? RefundBankCardNo { get; set; }
        
        [Column("refund_bank_open_name")]
        public string? RefundBankOpenName { get; set; }
        
        [Column("refund_bank_city")]
        public string? RefundBankCity { get; set; }
        
        [Column("refund_amount")]
        public decimal? RefundAmount { get; set; }
        
        [Column("public_agent_name")]
        public string? PublicAgentName { get; set; }
        
        [Column("public_agent_phone_number")]
        public string? PublicAgentPhoneNumber { get; set; }
        
        [Column("public_agent_relation")]
        public string? PublicAgentRelation { get; set; }
        
        [Column("public_agent_relation_id")]
        public string? PublicAgentRelationId { get; set; }
        
        [Column("public_agent_refund_bank_name")]
        public string? PublicAgentRefundBankName { get; set; }
        
        [Column("public_agent_refund_bank_card_no")]
        public string? PublicAgentRefundBankCardNo { get; set; }
        
        [Column("public_agent_refund_bank_open_name")]
        public string? PublicAgentRefundBankOpenName { get; set; }
        
        [Column("public_agent_refund_bank_city")]
        public string? PublicAgentRefundBankCity { get; set; }
        
        [Column("audit_user_id")]
    public string? AuditUserId { get; set; }

    [Column("audit_user_name")]
    public string? AuditUserName { get; set; }

    [Column("audit_result")]
    public string? AuditResult { get; set; }
        
        [Column("audit_date")]
        public DateTime? AuditDate { get; set; }
        
        [Column("refund_type_name")]
        public string? RefundTypeName { get; set; }
        
        [Column("refund_type_id")]
        public string? RefundTypeId { get; set; }
        
        [Column("audit_comment")]
        public string? AuditComment { get; set; }
        
        [Column("rel_id")]
        public string? RelId { get; set; }
        
        [Column("bank_card_holder")]
        public string? BankCardHolder { get; set; } // 银行卡开户人名字
        
        [Column("refund_balance")]
        public decimal? RefundBalance { get; set; } // 实际退款金额
        
        [Column("refund_balance_sn")]
        public string? RefundBalanceSn { get; set; } // 退款流水号
        
        [Column("acct_id")]
        public string? AcctId { get; set; } // 结算ID
        
        [Column("his_refund_status")]
        public string? HisRefundStatus { get; set; } // HIS退费状态：NULL或空-未开始，waiting-等待HIS退费，completed-HIS退费完成
    }

    public class RefundMasterCreateRequest
    {
        public string? PatientId { get; set; }
        public string? PatName { get; set; }
        public string? IdNumber { get; set; }
        public string? PhoneNumber { get; set; }
        public string? RefundBankName { get; set; }
        public string? RefundBankCardNo { get; set; }
        public string? RefundBankOpenName { get; set; }
        public string? RefundBankCity { get; set; }
        public decimal? RefundAmount { get; set; }
        public string? PublicAgentName { get; set; }
        public string? PublicAgentPhoneNumber { get; set; }
        public string? PublicAgentRelation { get; set; }
        public string? PublicAgentRelationId { get; set; }
        public string? PublicAgentRefundBankName { get; set; }
        public string? PublicAgentRefundBankCardNo { get; set; }
        public string? PublicAgentRefundBankOpenName { get; set; }
        public string? PublicAgentRefundBankCity { get; set; }
        public string? RefundTypeName { get; set; }
        public string? RefundTypeId { get; set; }
        public string? BankCardHolder { get; set; } // 银行卡开户人名字
        public string? AcctId { get; set; } // 结算ID
        public List<RefundAttachCreateRequest> Attachments { get; set; } = new List<RefundAttachCreateRequest>();
    }

    public class RefundMasterUpdateRequest
    {
        public string? AuditUserId { get; set; }
        public string? AuditUserName { get; set; }
        public string? AuditResult { get; set; }
        public string? AuditComment { get; set; }
        public decimal? RefundBalance { get; set; } // 实际退款金额
        public string? RefundBalanceSn { get; set; } // 退款流水号
        public string? AcctId { get; set; } // 结算ID
        public string? HisRefundStatus { get; set; } // HIS退费状态
    }

    public class BatchSettleRequest
    {
        public List<int> RefundIds { get; set; } = new List<int>();
        public string? OperatorName { get; set; }
        public string? OperatorFullName { get; set; }
    }

    public class BatchSettleResponse
    {
        public string AcctId { get; set; } = string.Empty;
        public decimal TotalAmount { get; set; }
        public int SettledCount { get; set; }
        public DateTime SettleDate { get; set; }
    }

    public class UpdateHisRefundStatusRequest
    {
        public int Id { get; set; }
        public string HisRefundStatus { get; set; } = string.Empty;
    }
}